using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace ICP_MS.Plugin.Tune;

public class FormMassFactor : Form
{
	private MassFactor factor = null;

	private IContainer components = null;

	private Label lblSymbol;

	private TextBox txtSymbol;

	private TextBox txtMass;

	private Label lblMass;

	private Label lblkDC;

	private Label lblbDC;

	private Label lblkRF;

	private Label lblbRF;

	private TextBox txtkDC;

	private TextBox txtbDC;

	private TextBox txtkRF;

	private TextBox txtbRF;

	private Button btnOK;

	private Button btnCancel;

	private TextBox txtEnd;

	private Label label1;

	private TextBox txtBegin;

	private Label label2;

	public FormMassFactor(MassFactor factor)
	{
		InitializeComponent();
		this.factor = factor;
	}

	private void btnOK_Click(object sender, EventArgs e)
	{
		try
		{
			double start = Convert.ToDouble(txtBegin.Text);
			double end = Convert.ToDouble(txtEnd.Text);
			double kDC = Convert.ToDouble(txtkDC.Text);
			double bDC = Convert.ToDouble(txtbDC.Text);
			double kRF = Convert.ToDouble(txtkRF.Text);
			double bRF = Convert.ToDouble(txtbRF.Text);
			factor.kDC = kDC;
			factor.bDC = bDC;
			factor.kRF = kRF;
			factor.bRF = bRF;
			factor.start = start;
			factor.end = end;
			base.DialogResult = DialogResult.OK;
		}
		catch
		{
			MessageBox.Show(Lang.Txt("FormMassFactor.MessageBox.FormatError.Text"));
		}
	}

	private void button1_Click(object sender, EventArgs e)
	{
		base.DialogResult = DialogResult.Cancel;
	}

	private void FormMassFactor_Load(object sender, EventArgs e)
	{
		txtSymbol.Text = factor.symbol;
		txtMass.Text = factor.mass.ToString("F3");
		txtBegin.Text = factor.start.ToString("F3");
		txtEnd.Text = factor.end.ToString("F3");
		txtkDC.Text = factor.kDC.ToString("F4");
		txtbDC.Text = factor.bDC.ToString("F4");
		txtkRF.Text = factor.kRF.ToString("F4");
		txtbRF.Text = factor.bRF.ToString("F4");
		ApplyResources();
	}

	private void ApplyResources()
	{
		Text = Lang.Txt("FormMassFactor.Title.Text");
		label2.Text = Lang.Txt("FormMassFactor.Start.Text");
		label1.Text = Lang.Txt("FormMassFactor.End.Text");
		lblbDC.Text = Lang.Txt("FormMassFactor.ResolutionCompensation.Text");
		lblbRF.Text = Lang.Txt("FormMassFactor.MassCompensation.Text");
		lblkDC.Text = Lang.Txt("FormMassFactor.ResolutionGain.Text");
		lblkRF.Text = Lang.Txt("FormMassFactor.MassGain.Text");
		lblMass.Text = Lang.Txt("FormMassFactor.Mass.Text");
		lblSymbol.Text = Lang.Txt("FormMassFactor.Element.Text");
		btnCancel.Text = Lang.Txt("FormMassFactor.Button.Cancel.Text");
		btnOK.Text = Lang.Txt("FormMassFactor.Button.OK.Text");
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.lblSymbol = new System.Windows.Forms.Label();
		this.txtSymbol = new System.Windows.Forms.TextBox();
		this.txtMass = new System.Windows.Forms.TextBox();
		this.lblMass = new System.Windows.Forms.Label();
		this.lblkDC = new System.Windows.Forms.Label();
		this.lblbDC = new System.Windows.Forms.Label();
		this.lblkRF = new System.Windows.Forms.Label();
		this.lblbRF = new System.Windows.Forms.Label();
		this.txtkDC = new System.Windows.Forms.TextBox();
		this.txtbDC = new System.Windows.Forms.TextBox();
		this.txtkRF = new System.Windows.Forms.TextBox();
		this.txtbRF = new System.Windows.Forms.TextBox();
		this.btnOK = new System.Windows.Forms.Button();
		this.btnCancel = new System.Windows.Forms.Button();
		this.txtEnd = new System.Windows.Forms.TextBox();
		this.label1 = new System.Windows.Forms.Label();
		this.txtBegin = new System.Windows.Forms.TextBox();
		this.label2 = new System.Windows.Forms.Label();
		base.SuspendLayout();
		this.lblSymbol.AutoSize = true;
		this.lblSymbol.Location = new System.Drawing.Point(42, 15);
		this.lblSymbol.Name = "lblSymbol";
		this.lblSymbol.Size = new System.Drawing.Size(35, 12);
		this.lblSymbol.TabIndex = 0;
		this.lblSymbol.Text = "元素:";
		this.txtSymbol.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
		this.txtSymbol.Location = new System.Drawing.Point(83, 12);
		this.txtSymbol.Name = "txtSymbol";
		this.txtSymbol.ReadOnly = true;
		this.txtSymbol.Size = new System.Drawing.Size(59, 21);
		this.txtSymbol.TabIndex = 1;
		this.txtSymbol.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.txtMass.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
		this.txtMass.Location = new System.Drawing.Point(219, 12);
		this.txtMass.Name = "txtMass";
		this.txtMass.ReadOnly = true;
		this.txtMass.Size = new System.Drawing.Size(59, 21);
		this.txtMass.TabIndex = 3;
		this.txtMass.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.lblMass.AutoSize = true;
		this.lblMass.Location = new System.Drawing.Point(165, 16);
		this.lblMass.Name = "lblMass";
		this.lblMass.Size = new System.Drawing.Size(47, 12);
		this.lblMass.TabIndex = 2;
		this.lblMass.Text = "质量数:";
		this.lblkDC.AutoSize = true;
		this.lblkDC.Location = new System.Drawing.Point(12, 79);
		this.lblkDC.Name = "lblkDC";
		this.lblkDC.Size = new System.Drawing.Size(71, 12);
		this.lblkDC.TabIndex = 4;
		this.lblkDC.Text = "分辨率增益:";
		this.lblbDC.AutoSize = true;
		this.lblbDC.Location = new System.Drawing.Point(12, 108);
		this.lblbDC.Name = "lblbDC";
		this.lblbDC.Size = new System.Drawing.Size(71, 12);
		this.lblbDC.TabIndex = 5;
		this.lblbDC.Text = "分辨率补偿:";
		this.lblkRF.AutoSize = true;
		this.lblkRF.Location = new System.Drawing.Point(12, 137);
		this.lblkRF.Name = "lblkRF";
		this.lblkRF.Size = new System.Drawing.Size(71, 12);
		this.lblkRF.TabIndex = 6;
		this.lblkRF.Text = "质量轴增益:";
		this.lblbRF.AutoSize = true;
		this.lblbRF.Location = new System.Drawing.Point(12, 168);
		this.lblbRF.Name = "lblbRF";
		this.lblbRF.Size = new System.Drawing.Size(71, 12);
		this.lblbRF.TabIndex = 7;
		this.lblbRF.Text = "质量轴补偿:";
		this.txtkDC.Location = new System.Drawing.Point(98, 75);
		this.txtkDC.Name = "txtkDC";
		this.txtkDC.Size = new System.Drawing.Size(100, 21);
		this.txtkDC.TabIndex = 8;
		this.txtkDC.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.txtbDC.Location = new System.Drawing.Point(98, 105);
		this.txtbDC.Name = "txtbDC";
		this.txtbDC.Size = new System.Drawing.Size(100, 21);
		this.txtbDC.TabIndex = 9;
		this.txtbDC.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.txtkRF.Location = new System.Drawing.Point(98, 134);
		this.txtkRF.Name = "txtkRF";
		this.txtkRF.Size = new System.Drawing.Size(100, 21);
		this.txtkRF.TabIndex = 10;
		this.txtkRF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.txtbRF.Location = new System.Drawing.Point(98, 165);
		this.txtbRF.Name = "txtbRF";
		this.txtbRF.Size = new System.Drawing.Size(100, 21);
		this.txtbRF.TabIndex = 11;
		this.txtbRF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.btnOK.Location = new System.Drawing.Point(220, 102);
		this.btnOK.Name = "btnOK";
		this.btnOK.Size = new System.Drawing.Size(65, 24);
		this.btnOK.TabIndex = 12;
		this.btnOK.Text = "确定";
		this.btnOK.UseVisualStyleBackColor = true;
		this.btnOK.Click += new System.EventHandler(btnOK_Click);
		this.btnCancel.Location = new System.Drawing.Point(220, 134);
		this.btnCancel.Name = "btnCancel";
		this.btnCancel.Size = new System.Drawing.Size(65, 24);
		this.btnCancel.TabIndex = 13;
		this.btnCancel.Text = "取消";
		this.btnCancel.UseVisualStyleBackColor = true;
		this.btnCancel.Click += new System.EventHandler(button1_Click);
		this.txtEnd.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
		this.txtEnd.Location = new System.Drawing.Point(219, 39);
		this.txtEnd.Name = "txtEnd";
		this.txtEnd.Size = new System.Drawing.Size(59, 21);
		this.txtEnd.TabIndex = 17;
		this.txtEnd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(153, 42);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(59, 12);
		this.label1.TabIndex = 16;
		this.label1.Text = "扫描终止:";
		this.txtBegin.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
		this.txtBegin.Location = new System.Drawing.Point(83, 39);
		this.txtBegin.Name = "txtBegin";
		this.txtBegin.Size = new System.Drawing.Size(59, 21);
		this.txtBegin.TabIndex = 15;
		this.txtBegin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(18, 42);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(59, 12);
		this.label2.TabIndex = 14;
		this.label2.Text = "扫描起始:";
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(297, 253);
		base.Controls.Add(this.txtEnd);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.txtBegin);
		base.Controls.Add(this.label2);
		base.Controls.Add(this.btnCancel);
		base.Controls.Add(this.btnOK);
		base.Controls.Add(this.txtbRF);
		base.Controls.Add(this.txtkRF);
		base.Controls.Add(this.txtbDC);
		base.Controls.Add(this.txtkDC);
		base.Controls.Add(this.lblbRF);
		base.Controls.Add(this.lblkRF);
		base.Controls.Add(this.lblbDC);
		base.Controls.Add(this.lblkDC);
		base.Controls.Add(this.txtMass);
		base.Controls.Add(this.lblMass);
		base.Controls.Add(this.txtSymbol);
		base.Controls.Add(this.lblSymbol);
		base.Name = "FormMassFactor";
		base.ShowIcon = false;
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
		this.Text = "分辨率/质量轴系数";
		base.Load += new System.EventHandler(FormMassFactor_Load);
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
